package org.kardigen.lg.admin.client.training.event;

import org.kardigen.lg.service.client.proxy.TrainingChapterProxy;
import org.kardigen.lg.service.client.proxy.TrainingProxy;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class ChapterSelectionEvent extends GwtEvent<ChapterSelectionEvent.Handler> {

	public interface Handler extends EventHandler {

		void onEvent(ChapterSelectionEvent trainingEvent);
	}

	public static Type<ChapterSelectionEvent.Handler> TYPE = new Type<ChapterSelectionEvent.Handler>();
	private final TrainingChapterProxy proxy;
	private final TrainingProxy parent;

	public ChapterSelectionEvent(TrainingProxy parent, TrainingChapterProxy proxy) {
		this.parent = parent;
		this.proxy = proxy;
	}

	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.onEvent(this);
	}

	public TrainingChapterProxy getProxy() {
		return proxy;
	}

	public TrainingProxy getParent() {
	   return parent;
   }

}
